﻿CREATE FUNCTION [dbo].[fnGetLastEntryLogEntryForUser]
(@userID INT)
RETURNS INT
AS
BEGIN
	-- Declare the return variable here
	DECLARE @entryLogID int

SELECT TOP 1 @entryLogID = EntryLog.EntryLogID
FROM  EntryLog
WHERE UserID = @userID
order by EntryDate DESC 

	-- Return the result of the function
	RETURN @entryLogID

END

